package models;

import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.jpa.Model;
import util.PageUtil;

@Entity
@Table(name = "trade")
public class Trade extends Model {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "types_id")
	public Types types;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id")
	public Member member;
	@Column(name = "available")
	public int available;
	public static enum AvaiableStatus {
		in(1), end(0), cancel(-1);
		private int stat_value;
		AvaiableStatus(int stat) {
			this.stat_value = stat;
		}
		public int getStatValue() {
			return stat_value;
		}
	}
	@Column(name = "depict",length=65535)
	public String depict;
	@Column(name = "contract")
	public String contract;
	@Column(name = "email")
	public String email;
	@Column(name = "price")
	public String price;
	@Column(name = "tel")
	public String tel;
	@Column(name = "time", length = 19)
	public Date time;
	@Column(name = "title")
	public String title;
	@Column(name = "area")
	public String area;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "trade")
	public Set<TradeProductList> tradeproductlists = new HashSet<TradeProductList>(0);

	public Trade() {
	}

	






}